package com.token.sysflow.bean;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import com.token.sql.IntegrateSql;
import com.token.sql.AbstractTableBean;
/**
 * 环节基本信息
 * @author 代码创建
 */
public class FlowStepBasic extends AbstractTableBean {

	private String StepId; //环节ID
	private int SysId; //租户ID
	private String SysAddTime; //创建时间
	private String SysAddUser; //创建人
	private String SysEditTime; //修改时间
	private String SysEditUser; //修改人
	private String FlowId; //流程ID
	private String StepType; //环节类型
	private String StepName; //环节名称
	private int StepNumber; //序号
	private int StdHours; //KPI办理时间(h)
	private String StepDesc; //环节描述
	private String ForkCondition; //决策条件
	private String UseNotify; //知会开关
	private String NotifyWay; //知会方式
	private String HttpSubmitBefore; //提交前接口
	private String HttpSubmitAfter; //提交后接口
	private String HttpReturnBefore; //退回后接口

	public static String TABLE_NAME = "Flow_StepBasic";
	public static String TABLEKEY_NAME = "StepId";
	public FlowStepBasic (IntegrateSql f){
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
	}

	public FlowStepBasic (IntegrateSql f,ResultSet rs) throws SQLException{
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
		this.initParamToRs(rs);
	}

	public FlowStepBasic (IntegrateSql f,String keyValue) throws SQLException{
		super(f,TABLE_NAME);
		this.setKeyName(TABLEKEY_NAME);
		setCodePrepare(selectCodeById().toString());
		prepareSql.setPstValue(1, keyValue);
		ResultSet rs = executeQuery();
		if(rs.next()){
			initParamToRs(rs);
		}else{
			initParam();
		}
		rs.close();
	}

	@Override
	protected void initParam() {
		StepId = ""; //环节ID
		SysId = 0; //租户ID
		SysAddTime = ""; //创建时间
		SysAddUser = ""; //创建人
		SysEditTime = ""; //修改时间
		SysEditUser = ""; //修改人
		FlowId = ""; //流程ID
		StepType = ""; //环节类型
		StepName = ""; //环节名称
		StepNumber = 0; //序号
		StdHours = 0; //KPI办理时间(h)
		StepDesc = ""; //环节描述
		ForkCondition = ""; //决策条件
		UseNotify = ""; //知会开关
		NotifyWay = ""; //知会方式
		HttpSubmitBefore = ""; //提交前接口
		HttpSubmitAfter = ""; //提交后接口
		HttpReturnBefore = ""; //退回后接口
	}


	public void initParamToRs(ResultSet rs) throws SQLException{
		StepId = rs.getString("StepId"); //环节ID
		SysId = rs.getInt("SysId"); //租户ID
		SysAddTime = rs.getString("SysAddTime"); //创建时间
		SysAddUser = rs.getString("SysAddUser"); //创建人
		SysEditTime = rs.getString("SysEditTime"); //修改时间
		SysEditUser = rs.getString("SysEditUser"); //修改人
		FlowId = rs.getString("FlowId"); //流程ID
		StepType = rs.getString("StepType"); //环节类型
		StepName = rs.getString("StepName"); //环节名称
		StepNumber = rs.getInt("StepNumber"); //序号
		StdHours = rs.getInt("StdHours"); //KPI办理时间(h)
		StepDesc = rs.getString("StepDesc"); //环节描述
		ForkCondition = rs.getString("ForkCondition"); //决策条件
		UseNotify = rs.getString("UseNotify"); //知会开关
		NotifyWay = rs.getString("NotifyWay"); //知会方式
		HttpSubmitBefore = rs.getString("HttpSubmitBefore"); //提交前接口
		HttpSubmitAfter = rs.getString("HttpSubmitAfter"); //提交后接口
		HttpReturnBefore = rs.getString("HttpReturnBefore"); //退回后接口
		this.setKeyId(rs.getString("StepId"));
	}


	@Override
	protected int appendData() throws SQLException {
		int i = 1;
		prepareSql.setPstValue(i++,StepId); //环节ID
		prepareSql.setPstValue(i++,SysId); //租户ID
		prepareSql.setPstValue(i++,SysAddTime); //创建时间
		prepareSql.setPstValue(i++,SysAddUser); //创建人
		prepareSql.setPstValue(i++,SysEditTime); //修改时间
		prepareSql.setPstValue(i++,SysEditUser); //修改人
		prepareSql.setPstValue(i++,FlowId); //流程ID
		prepareSql.setPstValue(i++,StepType); //环节类型
		prepareSql.setPstValue(i++,StepName); //环节名称
		prepareSql.setPstValue(i++,StepNumber); //序号
		prepareSql.setPstValue(i++,StdHours); //KPI办理时间(h)
		prepareSql.setPstValue(i++,StepDesc); //环节描述
		prepareSql.setPstValue(i++,ForkCondition); //决策条件
		prepareSql.setPstValue(i++,UseNotify); //知会开关
		prepareSql.setPstValue(i++,NotifyWay); //知会方式
		prepareSql.setPstValue(i++,HttpSubmitBefore); //提交前接口
		prepareSql.setPstValue(i++,HttpSubmitAfter); //提交后接口
		prepareSql.setPstValue(i++,HttpReturnBefore); //退回后接口
		return i;
	}


	@Override
	public Vector<String> getFields() {
		Vector<String> vec = new Vector<String>();
		vec.addElement("StepId"); //环节ID
		vec.addElement("SysId"); //租户ID
		vec.addElement("SysAddTime"); //创建时间
		vec.addElement("SysAddUser"); //创建人
		vec.addElement("SysEditTime"); //修改时间
		vec.addElement("SysEditUser"); //修改人
		vec.addElement("FlowId"); //流程ID
		vec.addElement("StepType"); //环节类型
		vec.addElement("StepName"); //环节名称
		vec.addElement("StepNumber"); //序号
		vec.addElement("StdHours"); //KPI办理时间(h)
		vec.addElement("StepDesc"); //环节描述
		vec.addElement("ForkCondition"); //决策条件
		vec.addElement("UseNotify"); //知会开关
		vec.addElement("NotifyWay"); //知会方式
		vec.addElement("HttpSubmitBefore"); //提交前接口
		vec.addElement("HttpSubmitAfter"); //提交后接口
		vec.addElement("HttpReturnBefore"); //退回后接口
		return vec;
	}


	/**
	 * 设置环节ID
	 * @param stepid
	 */
	public void setStepId(String stepid){
		StepId = stepid;
	}
	/**
	 * 获取StepId
	 * @return 环节ID
	 */
	public String getStepId(){
		return StepId;
	}

	/**
	 * 设置租户ID
	 * @param sysid
	 */
	public void setSysId(int sysid){
		SysId = sysid;
	}
	/**
	 * 获取SysId
	 * @return 租户ID
	 */
	public int getSysId(){
		return SysId;
	}

	/**
	 * 设置创建时间
	 * @param sysaddtime
	 */
	public void setSysAddTime(String sysaddtime){
		SysAddTime = sysaddtime;
	}
	/**
	 * 获取SysAddTime
	 * @return 创建时间
	 */
	public String getSysAddTime(){
		return SysAddTime;
	}

	/**
	 * 设置创建人
	 * @param sysadduser
	 */
	public void setSysAddUser(String sysadduser){
		SysAddUser = sysadduser;
	}
	/**
	 * 获取SysAddUser
	 * @return 创建人
	 */
	public String getSysAddUser(){
		return SysAddUser;
	}

	/**
	 * 设置修改时间
	 * @param sysedittime
	 */
	public void setSysEditTime(String sysedittime){
		SysEditTime = sysedittime;
	}
	/**
	 * 获取SysEditTime
	 * @return 修改时间
	 */
	public String getSysEditTime(){
		return SysEditTime;
	}

	/**
	 * 设置修改人
	 * @param sysedituser
	 */
	public void setSysEditUser(String sysedituser){
		SysEditUser = sysedituser;
	}
	/**
	 * 获取SysEditUser
	 * @return 修改人
	 */
	public String getSysEditUser(){
		return SysEditUser;
	}

	/**
	 * 设置流程ID
	 * @param flowid
	 */
	public void setFlowId(String flowid){
		FlowId = flowid;
	}
	/**
	 * 获取FlowId
	 * @return 流程ID
	 */
	public String getFlowId(){
		return FlowId;
	}

	/**
	 * 设置环节类型
	 * @param steptype
	 */
	public void setStepType(String steptype){
		StepType = steptype;
	}
	/**
	 * 获取StepType
	 * @return 环节类型
	 */
	public String getStepType(){
		return StepType;
	}

	/**
	 * 设置环节名称
	 * @param stepname
	 */
	public void setStepName(String stepname){
		StepName = stepname;
	}
	/**
	 * 获取StepName
	 * @return 环节名称
	 */
	public String getStepName(){
		return StepName;
	}

	/**
	 * 设置序号
	 * @param stepnumber
	 */
	public void setStepNumber(int stepnumber){
		StepNumber = stepnumber;
	}
	/**
	 * 获取StepNumber
	 * @return 序号
	 */
	public int getStepNumber(){
		return StepNumber;
	}

	/**
	 * 设置KPI办理时间(h)
	 * @param stdhours
	 */
	public void setStdHours(int stdhours){
		StdHours = stdhours;
	}
	/**
	 * 获取StdHours
	 * @return KPI办理时间(h)
	 */
	public int getStdHours(){
		return StdHours;
	}

	/**
	 * 设置环节描述
	 * @param stepdesc
	 */
	public void setStepDesc(String stepdesc){
		StepDesc = stepdesc;
	}
	/**
	 * 获取StepDesc
	 * @return 环节描述
	 */
	public String getStepDesc(){
		return StepDesc;
	}

	/**
	 * 设置决策条件
	 * @param forkcondition
	 */
	public void setForkCondition(String forkcondition){
		ForkCondition = forkcondition;
	}
	/**
	 * 获取ForkCondition
	 * @return 决策条件
	 */
	public String getForkCondition(){
		return ForkCondition;
	}

	/**
	 * 设置知会开关
	 * @param usenotify
	 */
	public void setUseNotify(String usenotify){
		UseNotify = usenotify;
	}
	/**
	 * 获取UseNotify
	 * @return 知会开关
	 */
	public String getUseNotify(){
		return UseNotify;
	}

	/**
	 * 设置知会方式
	 * @param notifyway
	 */
	public void setNotifyWay(String notifyway){
		NotifyWay = notifyway;
	}
	/**
	 * 获取NotifyWay
	 * @return 知会方式
	 */
	public String getNotifyWay(){
		return NotifyWay;
	}

	/**
	 * 设置提交前接口
	 * @param httpsubmitbefore
	 */
	public void setHttpSubmitBefore(String httpsubmitbefore){
		HttpSubmitBefore = httpsubmitbefore;
	}
	/**
	 * 获取HttpSubmitBefore
	 * @return 提交前接口
	 */
	public String getHttpSubmitBefore(){
		return HttpSubmitBefore;
	}

	/**
	 * 设置提交后接口
	 * @param httpsubmitafter
	 */
	public void setHttpSubmitAfter(String httpsubmitafter){
		HttpSubmitAfter = httpsubmitafter;
	}
	/**
	 * 获取HttpSubmitAfter
	 * @return 提交后接口
	 */
	public String getHttpSubmitAfter(){
		return HttpSubmitAfter;
	}

	/**
	 * 设置退回后接口
	 * @param httpreturnbefore
	 */
	public void setHttpReturnBefore(String httpreturnbefore){
		HttpReturnBefore = httpreturnbefore;
	}
	/**
	 * 获取HttpReturnBefore
	 * @return 退回后接口
	 */
	public String getHttpReturnBefore(){
		return HttpReturnBefore;
	}

}
